﻿//********************************************************************************//
//创建日期：<创建日期，2017-6-23>
//创建作者：<郭登杰，guodengjie@shanghai3h.com>
//功能说明：非税文件信息_地表水Model
//********************************************************************************//
using System;
using System.Collections.Generic;
using YXYLCommon;
using System.Data;

namespace Entity
{
    [Serializable]
    /// <summary>
    /// 非税文件信息_地表水
    /// </summary>
    public class QSZWFSWJXX_DBS : BaseModel
    {
        public QSZWFSWJXX_DBS()
        {

        }

        public string S_FILENAME { get; set; }
        public string S_PICI { get; set; }
        public string S_DANWEIBH { get; set; }
        public string S_BUMENBH { get; set; }
        public byte[] S_FILESTREAM { get; set; }
        public string S_CAOZUOR { get; set; }

        public int I_FILEID { get; set; }
        public int I_TYPE { get; set; }
        public int I_JIEDUANS { get; set; }
        public int I_JLZT { get; set; }

        public DbDateTime D_CREATEDATE { get; set; }
        public DbDateTime D_DAORURQ { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.S_BUMENBH = row.Table.Columns.Contains("S_BUMENBH") ? Convert.ToString(row["S_BUMENBH"]) : null;
            this.S_CAOZUOR = row.Table.Columns.Contains("S_CAOZUOR") ? Convert.ToString(row["S_CAOZUOR"]) : null;
            this.S_DANWEIBH = row.Table.Columns.Contains("S_DANWEIBH") ? Convert.ToString(row["S_DANWEIBH"]) : null;
            this.S_FILENAME = row.Table.Columns.Contains("S_FILENAME") ? Convert.ToString(row["S_FILENAME"]) : null;
            this.S_FILESTREAM = row.Table.Columns.Contains("S_FILESTREAM") && row["S_FILESTREAM"]!=Convert.DBNull ? (byte[])(row["S_FILESTREAM"]) : null;
            this.S_PICI = row.Table.Columns.Contains("S_PICI") ? Convert.ToString(row["S_PICI"]) : null;

            if (row.Table.Columns.Contains("I_FILEID"))
            {
                this.I_FILEID = Convert.ToInt32(row["I_FILEID"]);
            }
            if (row.Table.Columns.Contains("I_JIEDUANS"))
            {
                this.I_JIEDUANS = Convert.ToInt32(row["I_JIEDUANS"]);
            }
            if (row.Table.Columns.Contains("I_JLZT"))
            {
                this.I_JLZT = Convert.ToInt32(row["I_JLZT"]);
            }
            if (row.Table.Columns.Contains("I_TYPE"))
            {
                this.I_TYPE = Convert.ToInt32(row["I_TYPE"]);
            }
            this.D_CREATEDATE = row.Table.Columns.Contains("D_CREATEDATE") ?DbDateTime.Parse(row["D_CREATEDATE"]):DbDateTime.Parse(null);
            this.D_DAORURQ = row.Table.Columns.Contains("D_DAORURQ") ?DbDateTime.Parse(row["D_DAORURQ"]):DbDateTime.Parse(null);
            return this;
        }
    }

    /// <summary>
    /// 非税基础信息_地表水
    /// </summary>
    public class QSZWFSJCXX_DBS : BaseModel
    {
        public QSZWFSJCXX_DBS()
        {

        }

        public string SFILENAME { get; set; }
        public string SID { get; set; }
        public string SITEMID { get; set; }
        public string SNAME { get; set; }
        public string STYPE { get; set; }
        public string SSHORTNAME { get; set; }
        public string SCANCEL { get; set; }
        public string SMONEYWAY { get; set; }
        public string SMETRIC { get; set; }
        public string SSHORTID { get; set; }
        public string SBANKCODE { get; set; }
        public string SACCOUNTNO { get; set; }
        public string SACCOUNTNAME { get; set; }
        public string SCANCELFILENO { get; set; }
        public string SCANCELREMARK { get; set; }
        public string SMEMO { get; set; }

        public string SPJLX { get; set; }

        public string SCXBZ { get; set; }
        public string SZJLX { get; set; }


        public DbInt IORDERNO { get; set; }
        public DbInt ILISTNO { get; set; }
        public DbInt IID { get; set; }
        public DbInt INUMBER { get; set; }
        public DbInt IPAGENUM { get; set; }
        public DbInt IPAYTIME { get; set; }

        public DbDecimal NPAYUP { get; set; }
        public DbDecimal NPAYDOWN { get; set; }
        public DbDecimal NMONEY { get; set; }


        public DbDateTime DTREGDATE { get; set; }
        public DbDateTime DTCANCELDATE { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.SACCOUNTNAME = row.Table.Columns.Contains("SACCOUNTNAME") ? Convert.ToString(row["SACCOUNTNAME"]) : null;
            this.SACCOUNTNO = row.Table.Columns.Contains("SACCOUNTNO") ? Convert.ToString(row["SACCOUNTNO"]) : null;
            this.SBANKCODE = row.Table.Columns.Contains("SBANKCODE") ? Convert.ToString(row["SBANKCODE"]) : null;
            this.SCANCEL = row.Table.Columns.Contains("SCANCEL") ? Convert.ToString(row["SCANCEL"]) : null;
            this.SCANCELFILENO = row.Table.Columns.Contains("SCANCELFILENO") ? Convert.ToString(row["SCANCELFILENO"]) : null;
            this.SCANCELREMARK = row.Table.Columns.Contains("SCANCELREMARK") ? Convert.ToString(row["SCANCELREMARK"]) : null;
            this.SFILENAME = row.Table.Columns.Contains("SFILENAME") ? Convert.ToString(row["SFILENAME"]) : null;
            this.SID = row.Table.Columns.Contains("SID") ? Convert.ToString(row["SID"]) : null;
            this.SITEMID = row.Table.Columns.Contains("SITEMID") ? Convert.ToString(row["SITEMID"]) : null;
            this.SMEMO = row.Table.Columns.Contains("SMEMO") ? Convert.ToString(row["SMEMO"]) : null;
            this.SMETRIC = row.Table.Columns.Contains("SMETRIC") ? Convert.ToString(row["SMETRIC"]) : null;
            this.SMONEYWAY = row.Table.Columns.Contains("SMONEYWAY") ? Convert.ToString(row["SMONEYWAY"]) : null;
            this.SNAME = row.Table.Columns.Contains("SNAME") ? Convert.ToString(row["SNAME"]) : null;
            this.SSHORTID = row.Table.Columns.Contains("SSHORTID") ? Convert.ToString(row["SSHORTID"]) : null;
            this.SSHORTNAME = row.Table.Columns.Contains("SSHORTNAME") ? Convert.ToString(row["SSHORTNAME"]) : null;
            this.STYPE = row.Table.Columns.Contains("STYPE") ? Convert.ToString(row["STYPE"]) : null;
            this.SPJLX = row.Table.Columns.Contains("SPJLX") ? Convert.ToString(row["SPJLX"]) : null;
            this.SCXBZ = row.Table.Columns.Contains("SCXBZ") ? Convert.ToString(row["SCXBZ"]) : null;
            this.SZJLX = row.Table.Columns.Contains("SZJLX") ? Convert.ToString(row["SZJLX"]) : null;

            this.IID = row.Table.Columns.Contains("IID") ? DbInt.Parse(row["IID"]) : DbInt.Parse(null);
            this.ILISTNO = row.Table.Columns.Contains("ILISTNO") ? DbInt.Parse(row["ILISTNO"]) : DbInt.Parse(null);
            this.INUMBER = row.Table.Columns.Contains("INUMBER") ? DbInt.Parse(row["INUMBER"]) : DbInt.Parse(null);
            this.IORDERNO = row.Table.Columns.Contains("IORDERNO") ? DbInt.Parse(row["IORDERNO"]) : DbInt.Parse(null);
            this.IPAGENUM = row.Table.Columns.Contains("IPAGENUM") ? DbInt.Parse(row["IPAGENUM"]) : DbInt.Parse(null);
            this.IPAYTIME = row.Table.Columns.Contains("IPAYTIME") ? DbInt.Parse(row["IPAYTIME"]) : DbInt.Parse(null);

            this.NPAYDOWN = row.Table.Columns.Contains("NPAYDOWN") ? DbDecimal.Parse(row["NPAYDOWN"]) : DbDecimal.Parse(null);
            this.NPAYUP = row.Table.Columns.Contains("NPAYUP") ? DbDecimal.Parse(row["NPAYUP"]) : DbDecimal.Parse(null);
            this.NMONEY = row.Table.Columns.Contains("NMONEY") ? DbDecimal.Parse(row["NMONEY"]) : DbDecimal.Parse(null);

            this.DTCANCELDATE = row.Table.Columns.Contains("DTCANCELDATE") ? DbDateTime.Parse(row["DTCANCELDATE"]) : DbDateTime.Parse(null);
            this.DTREGDATE = row.Table.Columns.Contains("DTREGDATE") ? DbDateTime.Parse(row["DTREGDATE"]) : DbDateTime.Parse(null);
            return this;
        }
    }

    /// <summary>
    /// 非税下载信息_地表水
    /// </summary>
    public class QSZWFSXZXX_DBS : BaseModel
    {
        public QSZWFSXZXX_DBS()
        {

        }

        public string SFILENAME { get; set; }
        public string SID { get; set; }
        public string SBEGINID { get; set; }
        public string SBANKCODE { get; set; }
        public string SCASHIER { get; set; }

        public DbInt ILISTNO { get; set; }
        
        public DbDecimal NLATEFEE { get; set; }
        public DbDecimal NMONEY { get; set; }


        public DbDateTime DTREGDATE { get; set; }
        public DbDateTime DTCHECKBILL { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.SFILENAME = row.Table.Columns.Contains("SFILENAME") ? Convert.ToString(row["SFILENAME"]) : null;
            this.SID = row.Table.Columns.Contains("SID") ? Convert.ToString(row["SID"]) : null;
            this.SBANKCODE = row.Table.Columns.Contains("SBANKCODE") ? Convert.ToString(row["SBANKCODE"]) : null;
            this.SBEGINID = row.Table.Columns.Contains("SBEGINID") ? Convert.ToString(row["SBEGINID"]) : null;
            this.SCASHIER = row.Table.Columns.Contains("SCASHIER") ? Convert.ToString(row["SCASHIER"]) : null;

            this.ILISTNO = row.Table.Columns.Contains("ILISTNO") ? DbInt.Parse(row["ILISTNO"]) : DbInt.Parse(null);

            this.NLATEFEE = row.Table.Columns.Contains("NLATEFEE") ? DbDecimal.Parse(row["NLATEFEE"]) : DbDecimal.Parse(null);
            this.NMONEY = row.Table.Columns.Contains("NMONEY") ? DbDecimal.Parse(row["NMONEY"]) : DbDecimal.Parse(null);

            this.DTCHECKBILL = row.Table.Columns.Contains("DTCHECKBILL") ? DbDateTime.Parse(row["DTCHECKBILL"]) : DbDateTime.Parse(null);
            this.DTREGDATE = row.Table.Columns.Contains("DTREGDATE") ? DbDateTime.Parse(row["DTREGDATE"]) : DbDateTime.Parse(null);
            return this;
        }
    }

    /// <summary>
    /// 非税上传信息_地表水
    /// </summary>
    public class QSZWFSSCXX_DBS : BaseModel
    {
        public QSZWFSSCXX_DBS()
        {

        }

        public string SFILENAME { get; set; }
        public string SID { get; set; }
        public string SBEGINID { get; set; }
        public string STYPE { get; set; }
        public string SENDID { get; set; }
        public string SITEMID { get; set; }

        public DbInt INUMBER { get; set; }

        public DbDecimal NPRICE { get; set; }
        public DbDecimal NMONEY { get; set; }

        public override BaseModel ToObject(System.Data.DataRow row)
        {
            this.IsExists = true;
            this.SFILENAME = row.Table.Columns.Contains("SFILENAME") ? Convert.ToString(row["SFILENAME"]) : null;
            this.SID = row.Table.Columns.Contains("SID") ? Convert.ToString(row["SID"]) : null;
            this.SBEGINID = row.Table.Columns.Contains("SBEGINID") ? Convert.ToString(row["SBEGINID"]) : null;
            this.SENDID = row.Table.Columns.Contains("SENDID") ? Convert.ToString(row["SENDID"]) : null;
            this.SITEMID = row.Table.Columns.Contains("SITEMID") ? Convert.ToString(row["SITEMID"]) : null;
            this.STYPE = row.Table.Columns.Contains("STYPE") ? Convert.ToString(row["STYPE"]) : null;

            this.INUMBER = row.Table.Columns.Contains("INUMBER") ? DbInt.Parse(row["INUMBER"]) : DbInt.Parse(null);

            this.NPRICE = row.Table.Columns.Contains("NPRICE") ? DbDecimal.Parse(row["NPRICE"]) : DbDecimal.Parse(null);
            this.NMONEY = row.Table.Columns.Contains("NMONEY") ? DbDecimal.Parse(row["NMONEY"]) : DbDecimal.Parse(null);
            return this;
        }
    }

    public class DALQSZWFSJK_DBS : BaseDAL
    {
        public DALQSZWFSJK_DBS()
        {

        }
        protected override void fillSaveProc(BaseModel model)
        {

        }


        ///// <summary>
        ///// 生成数据
        ///// </summary>
        ///// <param name="zwym"></param>
        ///// <returns></returns>
        //public DbCmdResult SC(int zwym,int wtype)
        //{
        //    dbProc.Init("P_DXSZW_LCCWJK_SC");
        //    dbProc.AddParameter("V_ZWYM", zwym);
        //    dbProc.AddParameter("V_WTYPE", wtype);
        //    return CommonService.Ini().ExcuteProc(dbProc);
        //}

        /// <summary>
        /// 文件信息获取
        /// </summary>
        public List<QSZWFSWJXX_DBS> WJXX_HQ(int type,string filename)
        {
            dbProc.Init("P_QSZW_FEISHUIWJCX_DBS");
            dbProc.AddParameter("V_TYPE", type);
            dbProc.AddParameter("V_FILENAME", filename);
            return CommonService.Ini().GetList<QSZWFSWJXX_DBS>(dbProc);
        }

        /// <summary>
        /// 基础信息获取
        /// </summary>
        public List<QSZWFSJCXX_DBS> JCXX_HQ(string wjm, string jdbs, int order)
        {
            dbProc.Init("P_QSZW_FEISHUIMXXX_DBS");
            dbProc.AddParameter("V_WENJIANM", wjm);
            dbProc.AddParameter("V_JIEDUANBS", jdbs);
            dbProc.AddParameter("V_ORDER", order);
            return CommonService.Ini().GetList<QSZWFSJCXX_DBS>(dbProc);
        }

        /// <summary>
        /// 下载信息获取
        /// </summary>
        public List<QSZWFSXZXX_DBS> XZXX_HQ(string wjm, string jdbs, int order)
        {
            dbProc.Init("P_QSZW_FEISHUIMXXX_DBS");
            dbProc.AddParameter("V_WENJIANM", wjm);
            dbProc.AddParameter("V_JIEDUANBS", jdbs);
            dbProc.AddParameter("V_ORDER", order);
            return CommonService.Ini().GetList<QSZWFSXZXX_DBS>(dbProc);
        }

        /// <summary>
        /// 上传信息获取
        /// </summary>
        public List<QSZWFSSCXX_DBS> SCXX_HQ(string wjm, string jdbs, int order)
        {
            dbProc.Init("P_QSZW_FEISHUIMXXX_DBS");
            dbProc.AddParameter("V_WENJIANM", wjm);
            dbProc.AddParameter("V_JIEDUANBS", jdbs);
            dbProc.AddParameter("V_ORDER", order);
            return CommonService.Ini().GetList<QSZWFSSCXX_DBS>(dbProc);
        }
        /// <summary>
        /// 文件信息导入
        /// </summary>
        public DbCmdResult DR_WJXX(QSZWFSWJXX_DBS wjxx)
        {
            dbProc.Init("P_DBSZW_FEISHUIWJXXDR");
            dbProc.AddParameter("V_FILENAME", wjxx.S_FILENAME);
            dbProc.AddParameter("V_TYPE", wjxx.I_TYPE);
            dbProc.AddParameter("V_CREATEDATE", wjxx.D_CREATEDATE.TimeDBParameter);
            dbProc.AddParameter("V_PICI", wjxx.S_PICI);
            dbProc.AddParameter("V_BUMENBH", wjxx.S_BUMENBH);
            dbProc.AddParameter("V_JIEDUANS", wjxx.I_JIEDUANS);
            dbProc.AddParameterOracle("V_FILESTREAM", wjxx.S_FILESTREAM, Oracle.DataAccess.Client.OracleDbType.Blob);
            dbProc.AddParameter("V_CAOZUOR", wjxx.S_CAOZUOR);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }
        public DbCmdResult UPDATE_WJXX(QSZWFSWJXX_DBS wjxx)
        {
            dbProc.Init("P_DBSZW_FEISHUIWJXXXG");
            dbProc.AddParameter("V_FILENAME", wjxx.S_FILENAME);
            //dbProc.AddParameter("V_TYPE", wjxx.I_TYPE);
            //dbProc.AddParameter("V_CREATEDATE", wjxx.D_CREATEDATE.TimeDBParameter);
            //dbProc.AddParameter("V_PICI", wjxx.S_PICI);
            //dbProc.AddParameter("V_BUMENBH", wjxx.S_BUMENBH);
            //dbProc.AddParameter("V_JIEDUANS", wjxx.I_JIEDUANS);
            dbProc.AddParameter("V_FILESTREAM", wjxx.S_FILESTREAM);
            //dbProc.AddParameter("V_CAOZUOR", wjxx.S_CAOZUOR);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }
        /// <summary>
        /// 下载信息导入
        /// </summary>
        public DbCmdResult DR_XZXX(QSZWFSXZXX_DBS mxxx,string caozuor)
        {
            dbProc.Init("P_DBSZW_FEISHUIXZXXDR");
            dbProc.AddParameter("V_FILENAME", mxxx.SFILENAME);
            dbProc.AddParameter("V_LISTNO", mxxx.ILISTNO.DvalueDBParameter);
            dbProc.AddParameter("V_SID", mxxx.SID);
            dbProc.AddParameter("V_SBEGINID", mxxx.SBEGINID);
            dbProc.AddParameter("V_DTREGDATE", mxxx.DTREGDATE.TimeDBParameter);
            dbProc.AddParameter("V_SBANKCODE", mxxx.SBANKCODE);
            dbProc.AddParameter("V_NMONEY", mxxx.NMONEY.DvalueDBParameter);
            dbProc.AddParameter("V_NLATEFEE", mxxx.NLATEFEE.DvalueDBParameter);
            dbProc.AddParameter("V_SCASHIER", mxxx.SCASHIER);
            dbProc.AddParameter("V_DTCHECKBILL", mxxx.DTCHECKBILL.TimeDBParameter);
            dbProc.AddParameter("V_CAOZUOR", caozuor);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }
        /// <summary>
        /// 文件信息取消
        /// </summary>
        public DbCmdResult QX_WJXX(int type,string filename,string caozuor)
        {
            dbProc.Init("P_DBSZW_FEISHUIWJXXQX");
            dbProc.AddParameter("V_FILENAME", filename);
            dbProc.AddParameter("V_TYPE", type);            
            dbProc.AddParameter("V_CAOZUOR", caozuor);
            return CommonService.Ini().ExcuteProcOracle(dbProc);
        }

    }

}